<?php
$modules = Config::get('probackend::modules', array());

function switcher($on) {
    $html = '<div class="has-switch" tabindex="0">';
    if ($on) {
        $html .= '<div class="switch-on">';
    } else {
        $html .= '<div class="switch-off">';
    }
    $html .= '<span class="switch-left switch-small">ON</span>';
    $html .= '<label class="switch-small">&nbsp;</label>';
    $html .= '<span class="switch-right switch-small">OFF</span>';
    $html .= '<input type="checkbox" class="switch-small">';
    $html .= '</div>';
    $html .= '</div>';
    return $html;
}
?>


<div class="row">
    <div class="col-sm-4">
        <h6 class="text-center with-padding">Group info</h6>
        <table class="table table-striped" cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">
            <tbody>
                <tr>
                    <td>ID:</td>
                    <td>{{$id}}</td>
                </tr>
                <tr>
                    <td>Name</td>
                    <td>{{$name}}</td>
                </tr>
                <tr>
                    <td>Title</td>
                    <td>{{$title}}</td>
                </tr>
            </tbody>
        </table>
    </div>
    <div class="col-sm-8">
        <h6 class="text-center with-padding">Permistions of group</h6>
        <table class="table" cellpadding="1" cellspacing="0" border="0" style="padding-left:50px;">
            <tbody>
                @foreach ($modules as $moduleID => $module)
                <tr class="active">
                    <td colspan="2">{{"Module " . $module['name']}}</th>
                </tr>
                @foreach ($module['permistions'] as $permistionID => $permistionName)
                <tr class="">
                    <td>{{$permistionName}}</td>
                    <td>{{switcher(isset($permissions[$moduleID.'.'.$permistionID]))}}</td>
                </tr>
                @endforeach

                @endforeach
            </tbody>
        </table>
    </div>
</div>

